<?php

namespace app\common\model;

use think\Model;


class Banner extends Model
{





    // 表名
    protected $name = 'banner';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'page_text'
    ];

    public function getImageAttr($value, $data)
    {
        if ($value) {
            return cdnurl($value, true);
        }
        return '';
    }
    public function getPageList()
    {
        return [
            // 'policies' => [
            //     'pages' => 'pages/richdetail/richdetail?type=3',
            //     'name' => __('Page policies'),
            // ],
            'line' => [
                'pages' => 'pages/mall/routedetail/routedetail',
                'name' => __('路线详情'),
            ],
            'lease' => [
                'pages' => 'pages/mall/leasedetail/leasedetail',
                'name' => __('汽车租赁'),
            ],
            'campsite' => [
                'pages' => 'pages/mall/campdetail/campdetail',
                'name' => __('营地详情'),
            ],
            'car' => [
                'pages' => 'pages/mall/Cardetail/Cardetail',
                'name' => __('二手车详情'),
            ],
            'project' => [
                'pages' => 'pages/mall/detail/detail',
                'name' => __('项目报名'),
            ],
            'custom' => [
                'pages' => '',
                'name' => __('Page custom'),
            ],
        ];
    }
    public function getPageTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['page']) ? $data['page'] : '');
        $list = $this->getPageList();
        return isset($list[$value]) ? $list[$value] : '';
    }
}
